package gitee.derumin.really_forge.mixin;

import gitee.derumin.really_forge.items.AvailableInForging;
import gitee.derumin.really_forge.items.RFItems;
import net.minecraft.entity.player.ItemCooldownManager;
import net.minecraft.item.Item;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(ItemCooldownManager.class)
public class ItemCooldownManagerMixin {

    @ModifyVariable(method = "getCooldownProgress", at = @At("HEAD"), argsOnly = true)
    private Item uniform(Item item){
        if (item instanceof AvailableInForging){
            return RFItems.COPPER_HAMMER;
        }else {
            return item;
        }
    }

    @ModifyVariable(method = "set", at = @At("HEAD"), argsOnly = true)
    private Item uniformSet(Item item){
        if (item instanceof AvailableInForging){
            return RFItems.COPPER_HAMMER;
        }else {
            return item;
        }
    }

    @ModifyVariable(method = "remove", at = @At("HEAD"),argsOnly = true)
    private Item uniformRemove(Item item){
        if (item instanceof AvailableInForging){
            return RFItems.COPPER_HAMMER;
        }else {
            return item;
        }
    }
}
